import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.FlowLayout;



public class Menu2 {

	private JFrame frame;
	private JPanel panel;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Menu2 window = new Menu2();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public Menu2() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
		
		JPanel Send = new JPanel();
		Send.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent arg0) {
				setPanel("panelTask");
			}
		});
		tabbedPane.addTab("Send", null, Send, null);
		Send.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JPanel Queue = new JPanel();
		Queue.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent arg0) {
				setPanel("panelEvent");
			}
		});
		tabbedPane.addTab("Queue", null, Queue, null);
		Queue.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		JPanel Configuration = new JPanel();
		Configuration.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent arg0) {
				setPanel("panelPc");
			}
		});
		tabbedPane.addTab("Configuration", null, Configuration, null);
		Configuration.setLayout(new BorderLayout(0, 0));
	}
		public void setPanel(String s){
			Panel p = new Panel();
			panel.removeAll();
			//panel = p.getPanel(s);
			JPanel tmp = new JPanel();
			//tmp.setLayout(new BorderLayout());
			tmp=p.getPanel(s);
			panel.add(tmp);
			panel.repaint();
			panel.validate();
			panel.setVisible(true);
		}
}
